package pe.candyncoffee.mytrace.message;

import java.io.File;
import java.util.ArrayList;

import pe.candyncoffee.mytrace.Settings;
import pe.candyncoffee.mytrace.Utils;
import pe.candyncoffee.mytrace.photo.PhotoUtil;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class MessageUtil extends Utils{
	static void saveProfileCache(Context context, ArrayList<String> clientId, Bitmap[] profiles){
		for (int i=0; i<profiles.length; i++){
			String filename = Settings.cacheDir + "/" + clientId.get(i);
			if (profiles[i] != null)
				PhotoUtil.saveBitmap(context, profiles[i], filename);
		}
	}
	static Bitmap loadProfileCache(Context context, String clientId){
		String filename = Settings.cacheDir + "/" + clientId;
		File file = new File(filename);
		if (!file.exists())
			return null;
		return BitmapFactory.decodeFile(filename);
	}
}